from pydantic import BaseModel, Field
from typing import List, Optional

class BaseBuckling(BaseModel):
    order_id: Optional[int] = Field(0)
    goods_id: Optional[int] = Field(0)
    sku_id: Optional[int] = Field(0)
    user_id: Optional[int] = Field(0)
    nums: Optional[int] = Field(0)
    direction: Optional[int] = Field(0)
    add_uid: Optional[int] = Field(0)
    space_id: Optional[int] = Field(0)
    use_nums: Optional[int] = Field(0)
    last_nums: Optional[int] = Field(0)
    price: float = Field(0.00)

class BucklingCreate(BaseBuckling):
    ...

class BucklingUpdate(BaseBuckling):
    id: int
    def update_dict(self):
        return self.model_dump(exclude_unset=True, exclude={"id"})

class BaseBucklingDetail(BaseModel):
    buckling_id: Optional[int] = Field(0)
    nums: Optional[int] = Field(0)
    cases_id: Optional[int] = Field(0)
    buckling_price: float = Field(0.00)

class BucklingDetailCreate(BaseBucklingDetail):
    ...

class BucklingDetailUpdate(BaseBucklingDetail):
    id: int
    def update_dict(self):
        return self.model_dump(exclude_unset=True, exclude={"id"})


class BaseCases(BaseModel):
    user_id: Optional[int] = Field(0)
    add_uid: Optional[int] = Field(0)
    space_id: Optional[int] = Field(0)
    desc: Optional[str] = Field("")
    files:Optional[list] = Field(None)
    designer_ids: Optional[list] = Field(None)
    buckling_data: Optional[list] = Field(None)

class CasesCreate(BaseCases):
    ...

class CasesUpdate(BaseCases):
    id: int
    def update_dict(self):
        return self.model_dump(exclude_unset=True, exclude={"id"})

class PayCreate(BaseModel):
    id: Optional[int] = Field(0)
    user_id: Optional[int] = Field(0)
    type:int = 1 ##1点单类型2商城3储值
    sku: Optional[list] = None
    address_id: Optional[int] = Field(0)
    is_deposit: int = Field(0)
    coupons: Optional[list] = None
    remark: Optional[str] = Field(None)


class BaseSchedulingRules(BaseModel):
    label: Optional[str] = Field("")
    start: Optional[str] = Field("")
    end: Optional[str] = Field("")
    color: Optional[str] = Field("")


class SchedulingRulesCreate(BaseSchedulingRules):
    ...

class SchedulingRulesUpdate(BaseSchedulingRules):
    id: int
    def update_dict(self):
        return self.model_dump(exclude_unset=True, exclude={"id"})

class BaseSchedulingDates(BaseModel):
    rules_id: Optional[int] = Field(0)
    designer_id: Optional[int] = Field(0)
    start: Optional[str] = Field("")
    end: Optional[str] = Field("")
    date: Optional[str] = Field("")
    space_id: Optional[int] = Field(0)


class SchedulingDatesCreate(BaseSchedulingDates):
    ...

class SchedulingDatesUpdate(BaseSchedulingDates):
    id: int
    def update_dict(self):
        return self.model_dump(exclude_unset=True, exclude={"id"})